package banking7.domain;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:恋恋
 * Date:2022-11-03
 * Time:12:33
 */
public class CheckingAccount extends Account {
    double overdraftProtection;
    public CheckingAccount(double balance) {
        super(balance);
    }

    public CheckingAccount(double balance, double overdraftProtection) {
        super(balance);
        this.overdraftProtection = overdraftProtection;
    }
    @Override
    public boolean withdraw(double amt) {
        //当前余额足够弥补取款amt,则正常进行
        if (balance >= amt) {
            balance =balance-amt;
            return true;
        }

        this.balance = balance;//整个交易失败，但余额未受影响
        return false;


    }
}
